<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        html {
            font-family: Arial, Helvetica, sans-serif;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        main {
            display: flex;
            align-self: center;
            justify-self: center;
            height: 100vh;
        }
        
        .slider {
            width: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
        }
        
        .selected {
            position: relative;
            width: 80px;
            line-height: 40px;
            background-color: red;
            text-align: center;
            margin-right: 20px;
            border-radius: 4px;
            color: #fff;
        }
        
        .selected::after {
            position: absolute;
            content: '';
            top: 50%;
            right: -16px;
            margin-top: -8px;
            width: 0;
            height: 0;
            border: 8px solid transparent;
            border-left-color: red;
        }
        
        input[type='range'] {
            -webkit-appearance: none;
            width: 100%;
            height: 20px;
            border-radius: 4px;
            background: linear-gradient(135deg, blue, purple);
            outline: none;
        }
        
        input[type='range']::-webkit-slider-thumb {
            -webkit-appearance: none;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background-color: red;
        }
        
        input[type='range']:active::-webkit-slider-thumb {
            background-color: thistle;
            box-shadow: 0 0 0 6px brown;
        }
    </style>
</head>

<body>

    <main>
        <div class="slider">
            <span class="selected">50</span>
            <input class="slider-input" type="range" value="50" min="0" max="500" />
        </div>
    </main>
    <script>
        const sliderEl = document.querySelector('.slider-input');
        const selectedEl = document.querySelector('.selected');
        sliderEl.addEventListener('input', () => {
            selectedEl.innerHTML = sliderEl.value
        }, false)
    </script>
</body>

</html>